<?php

	class Submissao {
		
		private $_db ;

		public function Submissao($db) {
			$this->_db = $db ;
		}		
		
		public function submeter($id_sub, $id_usuario, $id_questao, $Linguage_nome, $data_recebimento, $status) {

			$submit_code = array ('id' => $id_sub,
								  'Linguagem_nome' => $Linguage_nome,
								  'data_recebimento' => $data_recebimento,
								  'status' => 'comp'); // compilando
								  
			$this->_db->insert('submissao', $submit_code) ;
			
			$reg_submit = array ('Questao_id' => $id_questao,
								 'Submissao_id' => $id_sub,
								 'Participante_id' => $id_usuario );
			
			$this->_db->insert('usuarioresponde', $reg_submit) ;
		}
		
		public function compilar($id_sub, $code) {
			$status = 'wa' ;
			// chamada
			$arr_update = array( 'status' => $status ) ;
			$this->_db->update('submissao', $arr_update, 'id = ' . $id_sub) ;
		}
		
		
	}
	
?>